home *** CD-ROM | disk | FTP | other *** search
/ Internet.Works 41 / Issue 41.iso / pc / Smoothwall / docs / kit.txt < prev    next >
Encoding:
Text File  |  2000-12-04  |  7.9 KB  |  209 lines

  1. <PRE>
  2. SmoothWall Kit Guide
  3.  
  4. By Lawrence Manning (guru@smoothwall.org)
  5.  
  6. Version: 1.0 - Date: 19/09/00
  7.  
  8. This is the SmoothWall develepment kit guide.  It describes, somewhat
  9. roughly, how to build the setup disks and ISO images, as well as describing
  10. various ways in which you can make changes to the smoothwall.tgz file.
  11.  
  12. 1. Directory layout.
  13.  
  14. Under smoothwall/ you wll see the current directories and a couple of files:
  15.  
  16. kernel.config :       
  17.     SmoothWall kernel config file.  The same config is used on the
  18. install disk as in a running smoothie.
  19. distrib/ :
  20.     This is a placeholder for the contents of smoothwall.tgz.  Start by
  21. installing a smoothwall.tgz from the CDROM into this directory.
  22. docs/ :
  23.     Documentation.
  24. install/ :
  25.     This directory contains stuff related to building the disk images
  26. and cdrom image, as well as some helper scripts.
  27. install/cdrom/ :
  28.     Contains a copy of what will be on a final cdrom image.  This
  29. includes the two floppy images and the smoothwall.tgz.
  30. install/installroot/ :
  31.     This is the contents of the rootfs part of disk1.  That is, it
  32. contains a mini linux, cdrom modules, and the install program.  It's based
  33. on VA 6.2.1 (RH 6.2) like the rest of smoothwall.  It uses the humungus
  34. glibc, mostly because it makes it easy to compile programs on a normal linux
  35. distrib that can be put streight on the floppy.
  36. install/kernelfs :
  37.     "kernelfs" is the name for the fs on disk1.  It contains the kernel,
  38. gziped rootfs, lilo config, and the message file.
  39. install/mnt :
  40.     A empty dir.  This is used as a mountpoint for when the install root
  41. image is created using loopback.  Basically a 4meg scratch file is created
  42. that is used as /dev/loop0, mkfsed, and mounted here.  Then the contents of
  43. installroot are copied in.  Its then unmounted, /dev/loop0 is deleted and
  44. the scratch file gziped.  The scratch file becomes installrootimage.gz and
  45. is copied into kernelfs.
  46. install/{makeimage,makelilo} :
  47.     Two little bash scripts.  These are explained below.
  48. pictures/
  49.     Pictures and archives of screengrabs.
  50. programs/
  51.     Directory for programs.  See Programs section.  Put the contents of
  52. smoothwall-progs-X.Y.Z.tar.gz in here.
  53. releases/
  54.     Directory for finished stuff.
  55. releases/images-X.Y.Z/
  56.     Contains finished disk and cdrom images prior to uploading.
  57. releases/sources-X.Y.Z/
  58.     Contains sourcecode archives.
  59.  
  60. 2. Description of bootdisk AKA disk1.
  61.  
  62. Creating a disk1 is a two stage process.
  63.  
  64. 2.1. The rootfs
  65.  
  66. install/installroot contains the disk1 root filesystem, where the install
  67. program and libraries live.  Space is *tight*.  There is currently no room
  68. whatsoever.  I used the BootDisk-HOWTO to make this.  All binaries (except
  69. modules) are stripped.  The install program runs on tty1, it uses tty2 for
  70. logging.  Some other ttys run ash.  A small program I wrote (source in
  71. programs/misc) called iowrap directs stdin/stdout/stderr to another
  72. terminal.  Init kicks off iowrap, which kicks off ash.  See /etc/inittab and
  73. the iowrap.c for more info.
  74.  
  75. The script makeimage makes installrootimage.gz from the files in installroot
  76. and copies it to kernelfs.
  77.  
  78. The other thing to note is modules.  /lib/modules/2.2.16/cdrom contains the
  79. cdrom modules.  The other directories (net etc) are sylinks into the cdrom
  80. directory.  The creation of the modules.dep file is a pain, and is described
  81. later on.
  82.  
  83. 2.2. kernelfs
  84.  
  85. This filesystem contains a kernel, lilo config, message file, and
  86. installrootimage.gz.  It's is created "on the fly" by the makelilo script. 
  87. To run this, have a disk in fd0.  There is currently no way to make disk1
  88. directly to a image file :(
  89.  
  90. 3. Disk2
  91.  
  92. The main thing to realise is that disk2 contains everything thats contained
  93. on the CDROM, without the smoothwall.tgz and disk image files.  So it
  94. contains:
  95.  
  96. lib/ :
  97.     Modules live here.  Some are not included.  eg ISDN, MASQ helpers
  98. etc.
  99. bin/ :
  100.     Currently contains: gzip, ifconfig, mke2fs, mksqp, fsdisk, tar and
  101. wget.  All stripped.
  102. partitiontable :
  103.     This is fed into sfdisk by the installer to partition the disks.
  104.  
  105. There are no scripts for the creation of this disk yet.  The contents of
  106. this disk are under install/cdrom.
  107.  
  108. Essentially, the last steps of creating a smoothwall release are:
  109.  
  110. Make a disk1 image.  Put the disk in the drive and dd it to a file
  111. smoothwall-disk1-X.Y.Z in install/cdrom.
  112.  
  113. Copy bin, lib and partitiontable to a mounted floppy.  umount it, and dd it
  114. to a disk2 file.  Put both disk images in the cdrom directory, along with
  115. the smoothwall.tgz.
  116.  
  117. Make the ISO from the cdrom dir, setting the disk1 image as the boot image. 
  118. Put the iso in release/images-X.Y.Z as smoothwall-cdrom-X.Y.Z.iso ready for
  119. uploading.
  120.  
  121. 4. Working with smoothwall.tgz
  122.  
  123. smoothwall.tgz is a minimised linux distribution.  The init scripts are very
  124. simple and all live in /etc/rc.d.  rc.sysinit is executed by init, and it
  125. calls rc.network and rc.firewall to set the network up, start deamons etc. 
  126. Config settings are in /etc/sysconfig and are VAR=VAL pairs.  These are
  127. written by the installer.
  128.  
  129. Ripping streight out of mail I wrote to Eric S. Johansson:
  130.  
  131. There are a number of ways to make changes to smoothwall.tgz.
  132.  
  133. Way 1. Make a directory on your main box called smoothwall/.  Untar
  134. smoothwall.tgz into it.  Assuming your /etc/passwd etc match the
  135. /etc/passwd, everything will be fine.  You can make your changes, tar up
  136. the lot all relative to the smoothwall dir, and do a network install from
  137. you test smoothwall box using your new smoothwall.tgz.
  138.  
  139. Way 2. Work on a live smoothwall.  Make your changes via telnet.  When you
  140. are done and things are tested, copy the changed files back over your
  141. local tree and tar up as before.
  142.  
  143. Way 3. Like 2, accept tar up on the smoothwall box itself.  This has
  144. problems in that the "runtime" files (especially those in /var) will be in
  145. you smoothwall.tgz.
  146.  
  147. I like Way 2.
  148.  
  149. 5. That modules.dep
  150.  
  151. If you want to recompile the SmoothWall kernel, you will need to do some
  152. hoop jumping to deal with modules.  I install my modules using the following
  153. script which I run from /usr/src/linux.
  154.  
  155. #!/bin/sh
  156. make INSTALL_MOD_PATH=/home/lawrence/smoothwall/distrib/ modules_install
  157. cp ip_masq_icq-0.56/ip_masq_icq.o
  158. /home/lawrence/smoothwall/distrib/lib/modules/2.2.16/ipv4/
  159. depmod -F System.map -b /home/lawrence/smoothwall/distrib/ -C conf.modules
  160. -n > /home/lawrence/smoothwall/distrib/lib/modules/2.2.16/modules.dep
  161.  
  162. The ip_masq_icq is an adition module for using icq over a masq link.  You
  163. can get it from:
  164. http://freshmeat.net/projects/ip_masq_icq/altdownload/ip_masq_icq-0.56.tar.gz
  165. Rather worryingly the homepage seems to have vanished :(
  166.  
  167. The conf.modules file should contain:
  168.  
  169. path[block]=/lib/modules/2.2.16
  170. path[fs]=/lib/modules/2.2.16
  171. path[misc]=/lib/modules/2.2.16
  172. path[net]=/lib/modules/2.2.16
  173. path[scsi]=/lib/modules/2.2.16
  174. path[usb]=/lib/modules/2.2.16
  175. path[cdrom]=/lib/modules/2.2.16
  176.  
  177. That will write a modules.dep into your smoothwall tree under distrib/.  You
  178. should copy that file to install/installroot/lib/modules/2.2.16 so it
  179. appears on your disk1 also.
  180.  
  181. 6. Programs
  182.  
  183. 6.1 Installer
  184.  
  185. Sections each have their own file.  It mounts the cdrom (or disk2 for
  186. network installs), fdisks and mkfses using the binaries on the cdrom.  Then
  187. it configures networking, asks for some passwords and then writes the
  188. settings to the various files.
  189.  
  190. TODO: Write more on this.
  191.  
  192. 6.2. iowrap
  193.  
  194. This is a simple program to direct fds 0, 1 and 2 to a file.  It's used by
  195. init to put the install program on tty1, shells on tty3 etc.
  196.  
  197. 6.2. setuid helpers
  198.  
  199. hupinet HUPs inet to get it to reread its configuration file.  It reads the
  200. pid from /var/run/inetd.pid and sends it HUP.  Simple.
  201.  
  202. restartdhcp is simular, but slightly more complicated because it actually
  203. has to kill dhcpd and restart it.  This is also called by rc.sysinit to
  204. start dhcpd off initally.
  205.  
  206. smoothiedeath just does a shutdown.  I wrote it so I wouldn't have to setuid
  207. shutdown itself.
  208. </PRE>
  209.